
_global_dict = {}

# 目前的全局变量：自身IP/漏洞攻击顺序/拓扑结构/socket连接池。定义如下
# self_ip = "ip0"
# att_met = [ip0 attack1; ip1 attack1]
# topo = [ip0, [ip1, ip2], ip3] ,ip4]
# 全局变量直接使用s("name",value)就可以设置
# g("name")就可以获取
def set_val(key, value):
	""" 定义一个全局变量 """
	global _global_dict
	_global_dict[key] = value
 
 
def get_val(key, defValue=None):
	global _global_dict
	""" 获得一个全局变量,不存在则返回默认值 """
	try:
		return _global_dict[key]
	except KeyError:
		return defValue